Repository navigation
Client: relaunch MasterTech while RemoteExec is armed - #366
Merged
Merged
Conversation
Arming RemoteExec registers a MastertechWatchdog scheduled task (logon plus a 5-minute repeat, both expiring an hour after the lease) that starts MasterTech with --watchdog. A --watchdog launch exits at once when the Local\MasterTech.Instance mutex shows an instance is running. Disarming or a normal close deletes the task; a close during Windows shutdown keeps it. The reboot relaunch task passes --watchdog too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
While RemoteExec is armed, MasterTech now comes back by itself when it dies or Windows restarts, so an overnight remote job doesn't stall until someone walks over to the machine.
MastertechWatchdogscheduled task for the logged-on user, at the highest run level. It has two triggers:MasterTech.exe --watchdog. A--watchdoglaunch exits at once when theLocal\MasterTech.Instancemutex shows an instance is already running. Every GUI and terminal instance opens that mutex at startup;--mcp-stdiodoes not.SM_SHUTTINGDOWN), so MasterTech returns after a reboot that MasterTech didn't start itself.MastertechAutoRestart) now passes--watchdogtoo, so the two tasks never start a second copy.IgnoreNew, so a running copy the task started blocks repeat launches;remote_exec_armtool description now tells agents that the relaunched client comes back disarmed and needs a re-arm.MTECH_NO_WATCHDOG=1skips registration.Why
A QC machine's MasterTech died mid-install overnight. Nothing could relaunch it until a technician came in, so the rest of the QC sat idle for the night. Webroot kills (see the vssadmin rule) end the session the same way.
Testing
IgnoreNew, highest run level;--watchdogparsing.EndBoundarykeeps its UTC offset,DeleteExpiredTaskAfterisPT0SandExecutionTimeLimitisPT0S;IgnoreNewstarts no new instance;-Forceand deleting withschtasks /deleteboth leave the running instance alive.cargo clippy -p MasterTech --no-deps --bin MasterTech --tests: nothing new.Clients need a release to pick this up.
🤖 Generated with Claude Code